package com.sapdroid.sapdroiddo.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Converter {
	private static final String DATE_STORE_FORMAT = "MM/dd/yyyy HH:mm:ss";

	public static String dateToString(Calendar calendar) {
		String strdate = null;

		SimpleDateFormat sdf = new SimpleDateFormat(DATE_STORE_FORMAT);

		if (calendar != null) {
			strdate = sdf.format(calendar.getTime());
		}
		return strdate;
	}

	public static Calendar stringToDate(String date) {
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_STORE_FORMAT);
		try {
			cal.setTime(sdf.parse(date));
		} catch (ParseException e) {
		}
		return cal;
	}

}
